package com.hf.job

import com.hf.bill.MailBillOfMonthAdminService
import com.hf.security.SystemConfigService

class BillOfMonthAdminJob {

	MailBillOfMonthAdminService mailBillOfMonthAdminService
	SystemConfigService systemConfigService

	static triggers = {
		// 11:00, last workday of period
		cron name: 'billOfMonthAdminJob', cronExpression: "0 00 11 ? * 1-7"
	}

	def execute() {
		if (systemConfigService.isBillDayOfPeriod()) {
			// execute job
			log.info "job run!"

			mailBillOfMonthAdminService.sendMail()

			log.info "bill month admin success"
		}
	}
}
